package cn.hanyx.vlog.bussiness.service;

import cn.hanyx.vlog.api.dto.ResponseObject;
import cn.hanyx.vlog.api.vo.Order;
import cn.hanyx.vlog.bussiness.feign.OrderFeign;
import cn.hanyx.vlog.bussiness.feign.PointsFeign;
import cn.hanyx.vlog.bussiness.feign.StorageFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * BussinessService
 *
 * @author hanyx
 * @date 2021/11/28
 */
@Slf4j
@Service
public class BussinessService {

    @Resource
    private OrderFeign orderFeign;

    @Resource
    private PointsFeign pointsFeign;

    @Resource
    private StorageFeign storageFeign;

    public Boolean sale(Order order) {
        Boolean flag = false;

        ResponseObject<Boolean> result = orderFeign.save(order);
        storageFeign.updateByOrder(order);
        pointsFeign.updateByOrder(order);

        flag = result.getData();
        return flag;
    }
}
